<!DOCTYPE html>
<?php
include "proses/konek.php";
session_start();
if(!isset($_SESSION['admin']))
   {   
   ?><script language="javascript">alert('anda blm login');
document.location='../'</script><?php
 }
else
{
$username = $_SESSION['admin'];

}
if(isset($_GET['target']))
{
    $target=$_GET['target'];
    $id=$_GET['id']; 
}
else
{
    echo "<script language='javascript'>alert('data tidak ada');</script>";
}
?>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>USER</title>

    <!-- Bootstrap Core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="css/plugins/metisMenu/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">


</head>

<body>

    <div id="wrapper">

        <!-- Navigation -->
        <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="dashboard.php">Admin</a>
            </div>
            <?php
            include 'proses/menustatic.php';
            $menustatic = new menustatic;
            $menustatic->menus();
             ?>
            <!-- /.navbar-static-side -->
        </nav>

        <!-- Page Content -->
        <div id="page-wrapper">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">	
			
					<h3>PROFILE USER</h3>
				
				<div class="">
					<?php
                if($target=='siswa')
                {
                    $sql=mysql_query("select * from siswa where id_siswa='$id'");
                    siswa($sql);
                }
                else
                {
                    $sql=mysql_query("select * from guru where id_guru='$id'");

                    guru($sql);
                }

                function guru($data)
                {
                    $cek=mysql_fetch_array($data);
                    ?>
                    <form class='form-horizontal'  action='../proses/update.php' method='post' enctype='multipart/form-data'>
                        <div class="form-group">
                            <div class="col-sm-12" style="margin-left:180px">
                            <a class="story-img" href="viewprofile.php?e=<?php echo $list['author']?>"><img src="<?php echo $cek['img'] ?>" style="width:100px;height:100px" class="img-circle"></a>        
                            </div>
                        </div>
                    
                            <div class="form-group" style="margin-left:170px"> 
                                <input id="icon" name="image" type="text" value="<?php echo $cek['img']?>">
                                <a href="javascript:open_popup('../plugin/filemanager/dialog.php?type=1&popup=1&field_id=icon')" class="btn iframe-btn btn-success" type="button" name="select1">select</a>    
                            </div>
                        <div class='form-group'>
                            <label class='col-sm-2 control-label'>Nama Depan</label>
                            <div class='col-sm-9'>
                                <input class='form-control' type='text' name='firstname' value="<?php echo $cek['first_name']?>" >
                            </div>
                        </div>
                        <div class='form-group'>
                            <label class='col-sm-2 control-label'>Nama Belakang</label>
                            <div class='col-sm-9'>
                                <input class='form-control' type='text' name='lastname' value="<?php echo $cek['last_name']?>">
                            </div>
                        </div>
                        <div class='form-group'>
                            <label class='col-sm-2 control-label'>Tanggal Lahir</label>
                            <div class='col-sm-9'>
                                <input class='form-control' type='text' name='ttl' value="<?php echo $cek['ttl']?>">
                            </div>
                        </div>
                        
                        <div class='form-group'>
                            <label class='col-sm-2 control-label'>Mata Pelajaran</label>
                            <div class='col-sm-9'>
                                <input class='form-control' type='text' name='mapel' value="<?php echo $cek['mapel'] ?>">
                            </div>
                        </div>
                        
                        <div class='form-group'>
                            <label class='col-sm-2 control-label'>Email</label>
                            <div class='col-sm-9'>
                                <input class='form-control' type='text' name='email' value="<?php echo $cek['email'] ?>">
                            </div>
                        </div>

                        <div class='form-group'>
                            <label class='col-sm-2 control-label'>Password</label>
                            <div class='col-sm-9'>
                                <input class='form-control' type='password' name='password' value="<?php echo $cek['pass']?>">
                            </div>
                        </div>

                        <div class='form-group'>
                            <div class='col-sm-offset-2 col-sm-10'>
                                <button class='btn btn-primary' type='submit' name='save' id='save'>Submit</button>
                            </div>
                        </div>
                        </form>
                         
                        </div><?php
                }

                function siswa($data)
                {
                    $cek=mysql_fetch_assoc($data);
                    ?><form class='form-horizontal'  action='../proses/update.php' method='post' enctype='multipart/form-data' name='form1' id='form1'>
                        <div class='form-group'>
                            <div class='col-sm-12' style='margin-left:180px'>
                            <a class='story-img'><img src="<?php echo $cek['img'] ?>" style='width:100px;height:100px' class='img-circle'></a>        
                            </div>
                        </div>
                    
                            <div class='form-group' style='margin-left:170px'> 
                                <input id='icon' name='image' type='text' value="<?php echo $cek['img'] ?>">
                                <a href="javascript:open_popup('../plugin/filemanager/dialog.php?type=1&popup=1&field_id=icon')" class='btn iframe-btn btn-success' type='button' name='select1'>select</a>    
                            </div>
                        <div class='form-group'>
                            <label class='col-sm-2 control-label'>Nama Depan</label>
                            <div class='col-sm-9'>
                                <input class='form-control' type='text' name='firstname' value="<?php echo $cek['first_nm'] ?>" >
                            </div>
                        </div>
                        <div class='form-group'>
                            <label class='col-sm-2 control-label'>Nama Belakang</label>
                            <div class='col-sm-9'>
                                <input class='form-control' type='text' name='lastname' value="<?php echo $cek['last_nm'] ?>">
                            </div>
                        </div>
                        <div class='form-group'>
                            <label class='col-sm-2 control-label'>Tanggal Lahir</label>
                            <div class='col-sm-9'>
                                <input class='form-control' type='text' name='kls' value="<?php echo $cek['kls'] ?>">
                            </div>
                        </div>
                
                        
                        <div class='form-group'>
                            <label class='col-sm-2 control-label'>Email</label>
                            <div class='col-sm-9'>
                                <input class='form-control' type='text' name='email' value="<?php echo $cek['email_sis'] ?>">
                            </div>
                        </div>

                        <div class='form-group'>
                            <label class='col-sm-2 control-label'>Password</label>
                            <div class='col-sm-9'>
                                <input class='form-control' type='password' name='password' value="<?php echo $cek['pass_sis'] ?>">
                            </div>
                        </div>

                        <div class='form-group'>
                            <div class='col-sm-offset-2 col-sm-10'>
                                <button class='btn btn-primary' type='submit' name='save' id='save'>Publish</button>
                            </div>
                        </div>
                        </form>
                         
                        </div><?php 
                }
                 ?>
                
                        <!-- content -->
                    </div>
                    <!-- /.col-lg-12 -->
                </div>
                <!-- /.row -->
            </div>
            <!-- /.container-fluid -->
        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->

    <script src="js/jquery.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="js/plugins/metisMenu/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="js/sb-admin-2.js"></script>
    <script src="js/jquery.fancybox.pack.js"></script>
<script type="text/javascript">
function open_popup(url)
{
        var w = 880;
        var h = 570;
        var l = Math.floor((screen.width-w)/2);
        var t = Math.floor((screen.height-h)/2);
        var win = window.open(url, 'ResponsiveFilemanager', "scrollbars=1,width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
}


</script>
</body>
</html>